﻿@{
    Layout = null;
    YiSha.Entity.YiDongYuan.DetectionMechanicsEntity mechanics = ViewBag.Mechanics;
    YiSha.Entity.YiDongYuan.DetectionResultEntity result = ViewBag.Result;
}
@using YiSha.Entity.YiDongYuan;
<!DOCTYPE html>
<html>
<head>
    <title>查看二维码</title>

    <link href="~/lib/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
    <style type="text/css">
        .continer {
            background-image: url('/image/cert.png');
            background-repeat: no-repeat;
            background-size: 100% 100%;
            -moz-background-size: 100% 100%;
            width: 500px;
            height: 500px;
        }

            .continer .view {
                padding-top: 100px;
                padding-left: 100px;
                line-height: 45px;
            }

            .continer span {
                display: block;
                font-size: 26px;
                font-weight: lighter;
            }

            .continer .company {
                display: block;
                font-size: 24px;
                text-align: center;
                font-weight: lighter;
                letter-spacing: -2px;
            }

        .print {
            width: 350px;
            height: 350px;
            font-weight: bold;
        }

            .print .view {
                padding-top: 35px;
                padding-left: 50px;
                line-height: 31px;
            }

            .print span {
                display: block;
                font-size: 16px;
                font-weight: lighter;
            }

            .print .company {
                display: block;
                margin: 5px 5px;
                font-size: 16px;
                text-align: center;
                font-weight: lighter;
                letter-spacing: 0px;
            }
    </style>
    <!-- 8.6*5.4 -->
    <script src="~/lib/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
    <input type="button" value="打印" id="btnPrint"
           class="btn btn-success btn-lg" style="margin: 10px 50px;" />
    <div class="continer">
        <div class="view">
            <span>环保号牌：@mechanics.HuanBaoCode</span> <span>机械名称：@mechanics.JXLB</span>
            @if (result != null)
            {
                <span>检验日期：@Convert.ToDateTime(result.testingtime).ToString("yyyy年MM月dd日")</span>
                <span>
                    检测结果：@result.accavg (m<sup>-1</sup>)
                </span>
            }
            else
            {
                <span>机械类型：@mechanics.JXDJLX</span>
            }
            <span>
                尾气处理装置：  "无"
            </span>
            @*<span>有效日期：@Convert.ToDateTime(test.testingtime).AddYears(1).ToString("yyyy年MM月dd日")</span>*@
            <span>检验机构：</span>
        </div>
        <div class="company">太原市大道源机动车检测有限公司</div>
    </div>
    <div class="print" style="display: none;">
        <div class="view">
            <span>环保号牌：@mechanics.HuanBaoCode </span> <span>机械名称：@mechanics.JXLB</span>
            @if (result == null)
            {
                <span>机械类型：@mechanics.JXDJLX</span>
            }
            else
            {
                <span>检验日期：@Convert.ToDateTime(result.testingtime).ToString("yyyy年MM月dd日")</span>
                <span>
                    检测结果： @result.accavg (m<sup>-1</sup>)
                </span>
            }
            <span>
                尾气处理装置："无"
            </span>
            @*<span>有效日期：@Convert.ToDateTime(test.testingtime).AddYears(1).ToString("yyyy年MM月dd日")</span>*@
            <span>检验机构：</span>
        </div>
        <div class="company">太原市大道源机动车检测有限公司</div>
    </div>
    <script type="text/javascript">
        $("#btnPrint").click(function () {
            $("#btnPrint").hide();
            $(".continer").hide();
            $(".print").show();
            window.print();
            $(".continer").show();
            $("#btnPrint").show();
            $(".print").hide();
        });
    </script>
</body>
</html>